from typing import Union, List

import uvicorn
from fastapi import FastAPI, Query, requests, Header
from pydantic import BaseModel

app = FastAPI()


class PageBase(BaseModel):
    page:str = None
    size:str = None
    t: Union[List[int],None] = Query(default=None)
    d: list=None


class Itme(PageBase):
    item:int
    her:str = Header(None)

@app.get('/')
def read_root(q:PageBase):
    print(requests)
    for i in q:
        print(i)
    return q

@app.post('/item/{item_id}',name='我来介绍一下这个接口')
def read_item(item_id:int,q:Union[str,None]=None):
    return {'item_id':item_id,'q':q}



if __name__ == '__main__':
    uvicorn.run(app,host='0.0.0.0',port=9527)
